package com.yitiao.data_algorithms.leetcode.editor.cn;
import com.yitiao.data_algorithms.leetcode.editor.cn.base.ListNode;
import com.yitiao.data_algorithms.leetcode.editor.cn.base.TreeNode;

class JumpGameIi{
    // 2022-09-02 10:55:29
    public static void main(String[] args) {
        Solution solution = new JumpGameIi().new Solution();
    }
    
    //leetcode submit region begin(Prohibit modification and deletion)
class Solution {
    public int jump(int[] nums) {
        int[] dp = new int[nums.length];
        dp[0] = 0;
        for (int i = 1; i < nums.length; i++) {
            int count = 10001;
            for (int j = 0; j < i; j++) {
                if (nums[j] >= i - j ) {
                    count = Math.min(count,dp[j]+1);
                }
            }
            dp[i] = count;
        }
        return dp[nums.length - 1];
    }
}
//leetcode submit region end(Prohibit modification and deletion)

}